package com.shou.lifecollege.modules.common.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shou.lifecollege.modules.common.entity.SysPermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: luotian
 * @Date: 2022/11/24 12:37
 */
@Mapper
public interface SysPermissionMapper extends BaseMapper<SysPermission> {
    /**
     * 根据用户id 获取资源
     * @param id
     * @return
     */
    @Select("SELECT t1.* FROM sys_permisssion t1 LEFT JOIN sys_role_permission t2 ON t1.id = t2.permissionid " +
            "LEFT JOIN sys_user_role t3 ON t3.roleid = t2.roleid " +
            "WHERE t3.usrid = #{id}")
    List<SysPermission> getPermissionListById(String id);
}
